<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="org.springframework.security.BadCredentialsException"%>
<%@page import="org.springframework.security.AuthenticationException"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>用户登录</title>
	</head>
	<body>
	<!-- 相当于 request.getParameter -->
	<s:if test="#parameters.error[0]=='true'">
		<%
			AuthenticationException ex = (AuthenticationException) session.getAttribute("SPRING_SECURITY_LAST_EXCEPTION");
			if(ex!=null){
				if(ex instanceof BadCredentialsException ){
					out.print("用户名或密码错误");
				}else{								
					//out.print(ex.getMessage());
					out.print("不存在该用户");
				}
			}
		%>
	</s:if>
	<form action="<s:url value='/j_spring_security_check'/>" method="post">
    	USERNAME:<input type="text" name="j_username" value="${sessionScope['SPRING_SECURITY_LAST_USERNAME']}" /><br/>
    	PASSWORD:<input type="password" name="j_password" value="" /><br/>
    	<!--input type="checkbox" name="_spring_security_remember_me" />两周之内不必登陆<br/-->
		<input type="submit" name="submit" value="登录">    	
    </form>
	</body>
</html>